package 力扣算法练习.main1.newPart1;

import java.util.Scanner;

public class day13 {
    //https://www.nowcoder.com/practice/fe6c73cb899c4fe1bdd773f8d3b42c3d?tpId=122&tqId=33649&ru=/exam/oj
/*        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            // 注意 hasNext 和 hasNextLine 的区别
            while (in.hasNextInt()) { // 注意 while 处理多个 case
                int num = in.nextInt();
                int power = in.nextInt();
                int[] arr=new int[num];
                for(int i=0;i<num;i++){
                    arr[i]=in.nextInt();
                }
                for(int i=0;i<num;i++){
                    if(arr[i]<=power){
                        power+=arr[i];
                    }else{
                        power+=gys(arr[i],power);
                    }
                }
                System.out.println(power);
            }
            */
    private static int gys(int a, int b) {
        int max = a > b ? a : b;
        for (int i = max; i > 0; i--) {
            if (a % i == 0 && b % i == 0) {
                return i;
            }
        }
        return 0;
    }


    //https://www.nowcoder.com/practice/e896d0f82f1246a3aa7b232ce38029d4?tpId=37&tqId=21282&ru=/exam/oj
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String in = sc.nextLine();
            char[] temp = in.toCharArray();
            int[] ch = new int[130];
            boolean flag=false;//记录有没有找到第一个只出现一次的字符
            for (int i = 0; i < temp.length; i++) {
                ch[temp[i]]++;
            }
            for (int i = 0; i < temp.length; i++) {
                if (ch[temp[i]]==1){
                    System.out.println(temp[i]);
                    flag=true;
                    break;
                }
            }
            if(flag){
                continue;
            }else{
                System.out.println(-1);
            }

        }
    }
    //题解
/*    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            //设置信号量
            int signal = 0;
            //读取输入内容
            String str = sc.nextLine();
            //遍历输入内容
            for(int i = 0; i < str.length(); i++){
                //判断每个字符是否出现第二次，如果存在，设置信号量signal为1；
                if(str.indexOf(str.charAt(i)) == str.lastIndexOf(str.charAt(i))){
                    System.out.print(str.charAt(i));
                    signal = 1;
                    break;
                }
            }
            //如果信号量为零，证明不存在重复字符
            if(signal == 0){
                System.out.println(-1);
            }
            //每读取一行输出一个回车
            System.out.println();
        }
    }*/
}
